package android.eventfinder;
import java.util.ArrayList;
import java.util.Collections;

public class Venue {
	protected String name;
	protected MyLocation location;
	protected ArrayList<Event> eventList;
	protected String city;
	protected String country;
	protected String street;
	protected String zip;
	
	Venue(String venueName, MyLocation venuLocation) {
		name = venueName;
		location = venuLocation;
		eventList = new ArrayList<Event>();
	}
	
	Venue(String venueName, MyLocation venuLocation, String venuStreet, String venuCity, String venuZip) {
		name = venueName;
		location = venuLocation;
		
		if (venuStreet == "?") {
			street = "";}
		else {
			street = venuStreet;
		}
		
		city = venuCity;
		zip = venuZip;
		eventList = new ArrayList<Event>();
	}
	
	public void addEvent(Event e) {
		eventList.add(e);
		this.sort();
	}
	
	@SuppressWarnings("unchecked")
	private void sort() {
		Collections.sort(eventList, new timeComparator());
	}

	public String getName() {
		return name;
	}

	public void setLocation(MyLocation loc) {
		 this.location = loc;
	}
	public String getAddress() {
		String retString = "";
		
		retString+= street + "\n" + city + ", " + zip; 
	
			
		return retString;
	}


	public void setName(String name) {
		 this.name = name;
	}
	public void setZip(String zip) {
		this.zip = zip;
	}
	public void setStreet(String street) {
		if (street == "?") {
			this.street = "";}
		else {
			this.street = street;
		}
	}
	public void setCity(String city) {
		this.city = city;
	}

	public String getCity() {
		return city;
	}

	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	public String getStreet() {
		return street;
	}

	public MyLocation getLocation() {
		return location;
	}
	
	public ArrayList<Event> getEventList() {
		return eventList;
	}
	
	public void setEventList(ArrayList<Event> eventList) {
		 this.eventList = eventList;
	}
	
	
}